CC		= g++
SRC_DIR		= ./src/
INC_DIR		= ./inc/

CFLAGS		= -Wall -W -Wextra -I$(INC_DIR)

SRC		= $(SRC_DIR)main.cpp \
		  $(SRC_DIR)GraphFactory.cpp \
		  $(SRC_DIR)Nibbler.cpp \
		  $(SRC_DIR)Snake.cpp \
		  $(SRC_DIR)Pomme.cpp

OBJ		= $(SRC:.cpp=.o)
NAME		= nibbler
RM		= rm -f

LDFLAGS		= -ldl

%.o:	%.cpp
	$(CC) -c $(CFLAGS) $^ -o $@ -I$(INC_DIR)

all:	$(NAME) libs

$(NAME): $(OBJ)
	$(CC) -o $(NAME)  $(OBJ) $(LDFLAGS)

clean:
	$(RM) $(OBJ)
	$(RM) *.so

fclean: clean
	$(RM) $(NAME)

libs: opengl sdl gtk

opengl:
	make -C ./lib/opengl/ re
	cp ./lib/opengl/*.so ./	

sdl:
	make -C ./lib/sdllib/ re
	cp ./lib/sdllib/*.so ./	

gtk:
	make -C ./lib/gtk/ re
	cp ./lib/gtk/*.so ./	

re: fclean all libs
